package ds;


public class SkillTree {
    public static class Skill implements Comparable<Skill> {
        public String name;
        public String iconPath;
        public int level = 0;
        public int maxLevel = 1;
        public boolean unlocked = false;
        public Skill(String name, String iconPath, int maxLevel) {
            this.name = name;
            this.iconPath = iconPath;
            this.maxLevel = maxLevel;
        }
        @Override
        public int compareTo(Skill o) {
            return this.name.compareTo(o.name); // 按名称排序，保证二叉树插入
        }
    }
    private MyTree tree;
    public SkillTree() {
        tree = new MyTree();
        // 构建二叉树结构
        Skill root = new Skill("技能树根", "images/skill_root.png", 1);
        Skill s1 = new Skill("加速", "images/skill_speed.png", 3);
        Skill s2 = new Skill("无敌", "images/skill_invincible.png", 2);
        Skill s3 = new Skill("分数加成", "images/skill_score.png", 2);
        Skill s4 = new Skill("穿墙", "images/skill_wall.png", 1);
        // 插入顺序决定结构
        tree.insert(root);
        tree.insert(s1);
        tree.insert(s2);
        tree.insert(s3);
        tree.insert(s4);
    }
    public MyTree getTree() { return tree; }
} 